mkdir -p /etc/apt/sources.d/
source_apt_debian(){
    cat <<EOF > /etc/apt/sources.list 
deb http://mirrors.ustc.edu.cn/debian/ buster main
deb-src http://mirrors.ustc.edu.cn/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main


deb http://mirrors.ustc.edu.cn/debian/ buster-updates main
deb-src http://mirrors.ustc.edu.cn/debian/ buster-updates main

deb http://mirrors.ustc.edu.cn/debian/ buster-backports main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ buster-backports main non-free contrib
EOF
case $source_version in
    '7') sed -i 's/buster/wheezy/g' /etc/apt/sources.list
        ;;
    '8') sed -i 's/buster/jessie/g' /etc/apt/sources.list
        ;;
    '9') sed -i 's/buster/stretch/g' /etc/apt/sources.list
        ;;
esac
    apt update
    service_install 'apt-transport-https ca-certificates  gnupg gnupg2 curl gnupg2 software-properties-common sudo'
    ##判断是否通过1参传入镜像站替换
	if [[ -n "$1" ]];then
		sed -i 's#http://mirrors.ustc.edu.cn#$1#g' /etc/apt/sources.list
        sed -i 's#http://security.debian.org#$1#g' /etc/apt/sources.list
	else
		green_zt "[ Debian${System_version} ]使用中国科技大学镜像站"
	fi
}
source_apt_ubuntu(){
    cat <<EOF > /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
EOF
#通过判断系统版本替换源内容即可实现(待完善)
case $source_version in
    '14') sed -i 's/focal/trusty/g' /etc/apt/sources.list
        ;;
    '16') sed -i 's/focal/xenial/g' /etc/apt/sources.list
        ;;
    '18') sed -i 's/focal/bionic/g' /etc/apt/sources.list
        ;;
esac
}
##备份源
source_apt_bak(){
    mkdir -p /etc/apt/sources.list.d/
    if [[ -f '/etc/apt/sources.list.bak' ]];then
        green_zt "文件[ /etc/apt/sources.list.bak ]已备份"
        rm -f /etc/apt/sources.list
    else
        cp /etc/apt/sources.list /etc/apt/sources.list.bak
        rm -f /etc/apt/sources.list
    fi
}
source_apt_docker-ce(){
    service_install " gnupg gnupg2 "
    rm -f gpg
    curl -fsSL https://mirrors.huaweicloud.com/docker-ce/linux/${System_Type}/gpg | apt-key add -
    rm -f gpg
    curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/${System_Type}/gpg | apt-key add -
    add-apt-repository "deb [arch=amd64] https://mirrors.huaweicloud.com/docker-ce/linux/${System_Type} $(lsb_release -cs) stable"
    ##判断是否通过1参传入镜像站替换
	if [[ -n "$1" ]];then
		sed -i "s#https://mirrors.huaweicloud.com/docker-ce/#${1}/docker-ce/#g" /etc/apt/sources.list
	else
        sed -i 's#https://mirrors.huaweicloud.com/docker-ce/#https://mirrors.aliyun.com/docker-ce/#g' /etc/apt/sources.list
		green_zt "[ Docker-ce源 ]使用阿里云镜像站"
	fi
    # sed -i "s#/docker-ce/linux/debian#/docker-ce/linux/${System_Type}#g" /etc/apt/sources.list
}
source_apt_k8s(){
    rm -f gpg
    curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
    apt update
    ##判断是否通过1参传入镜像站替换
	if [[ -n "$1" ]];then
		sed -i 's#https://mirrors.aliyun.com#$1#g' /etc/apt/sources.list
	else
		green_zt "使用阿里云镜像站"
	fi
}